<template>
  <div ref="chartContainer" style="width: 600px; height: 400px;"></div>
</template>

<script setup>
import { onMounted, ref } from 'vue';
import * as echarts from 'echarts';

const chartContainer = ref(null);

onMounted(() => {
  const myChart = echarts.init(chartContainer.value);
  const option = {
    series: [
      {
        type: 'graph',
        layout: 'force',
        data: [
          { name: '节点1', value: 10 },
          { name: '节点2', value: 20 },
          // ...更多节点数据
        ],
        edges: [
          { source: '节点1', target: '节点2' },
          // ...更多边数据
        ],
        force: {
          repulsion: 1000,
          edgeLength: 100,
        },
        preventOverlap: true,
        // 其他配置项...
      }
    ]
  };

  myChart.setOption(option);
});
</script>